package com.sw.youvote.client.areas;

import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.HasVerticalAlignment;
import com.sw.youvote.client.QuizListGUI;
import com.sw.youvote.shared.objects.QuizBean;

public class SidebarArea {
	
	private VerticalPanel panel;
	private Button addNewButton;
	private QuizListGUI gui;
	
	public SidebarArea(QuizListGUI parentGui){
		
		addNewButton = new Button("Add new Quiz");
		panel = new VerticalPanel();
		panel.setWidth("100%");
    	panel.setStylePrimaryName("header");
    	panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
    	// añadir widgets al panel
    	panel.add(addNewButton);
    	gui = parentGui;
	}
	public VerticalPanel getPanel(){
		return panel;
	}
	
	public Button getAddNewButton(){
		return addNewButton;
	}
	
	public void gui_eventAddNewButtonClicked() {
		gui.getSidebarArea().getAddNewButton().setVisible(true);
		gui.getFormularioCreacionArea().getUpdateButton().setVisible(false);
		gui.getFormularioCreacionArea().getAddButton().setVisible(true);
		gui.getFormularioCreacionArea().getAddCandidatureButton().setVisible(false);
        //this.descriptionField.setReadOnly(false);
		gui.getFormularioCreacionArea().loadForm(new QuizBean(),1);
	
    }
	
}
